package table.creators;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import controllers.AuthorHelper;
import models.Vehicle;
import controllers.Helper;
import controllers.TableModel;
import controllers.TableModel.AoColum;

public class VehicleTable {

    public static TableModel create(String current_user) {
        final String TYPE = "|运营车辆|社会车辆|挂靠车辆";
        final String TEAM = "|一车队|二车队|三车队|四车队|五车队";
    
        final String title = "车辆录入";
        String today = Helper.dateToString(new Date());
        String now = Helper.datetimeToString(new Date());

        List<AoColum> colums = new ArrayList<AoColum>();
        TableModel model = new TableModel();

        //                           name,             title,         required,     defaut,        cansearch, editable,    edit_type,    edit_data,            editable_settings    
        if(true) {
           colums.add(model.new AoColum("id",    "编号",    false,    "",    false,    false,    "select",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("buy_date",    "购车日期",    true,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("brand",    "厂牌信息",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("engine_number",    "发动机号",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("frame_number",    "车架号",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("factory_date",    "出厂日期",    true,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("seat_number",    "座位数",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("lwh",    "长、宽、高",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("plate_number",    "车牌号",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  true));
        }
        if(true) {
           colums.add(model.new AoColum("type",    "车辆属性",    true,    "0",    true,    true,    "select",    Helper.getSelectOptionJson(TYPE),    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("cancle_date",    "退牌日期",    true,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("team",    "所属车队",    true,    "0",    true,    true,    "select",    Helper.getSelectOptionJson(TEAM),    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("examine_date",    "验车日期",    true,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        model.buildModel(Vehicle.class, 600, title, AuthorHelper.canDo(current_user, title, "增加"), AuthorHelper.canDo(current_user, title, "搜索"), AuthorHelper.canDo(current_user, title, "删除"), colums);
        return model;
    }
}

